<template>
<el-row>
    <el-row>
    <!--新增/编辑界面 SmsReply 短信回复-->
        <el-form :model="editForm"  label-width="120px" :rules="editFormRules" ref="editFormRef">
            <el-form-item label="短信回复ID" prop="id">
                <el-input  v-model="editForm.id" placeholder="短信回复ID" :maxlength="64" @change="editSomeFields(editForm,'id',$event)" :disabled="  disabledJudge('id')"/>
            </el-form-item>
            <el-form-item label="通道扩展码，默认没有开通（需要填空）" prop="extend">
                <el-input  v-model="editForm.extend" placeholder="通道扩展码，默认没有开通（需要填空）" :maxlength="64" @change="editSomeFields(editForm,'extend',$event)" :disabled="  disabledJudge('extend')"/>
            </el-form-item>
            <el-form-item label="手机号码" prop="mobile">
                <el-input  v-model="editForm.mobile" placeholder="手机号码" :maxlength="15" @change="editSomeFields(editForm,'mobile',$event)" :disabled="  disabledJudge('mobile')"/>
            </el-form-item>
            <el-form-item label="国家（或地区）码" prop="nationcode">
                <el-input  v-model="editForm.nationcode" placeholder="国家（或地区）码" :maxlength="64" @change="editSomeFields(editForm,'nationcode',$event)" :disabled="  disabledJudge('nationcode')"/>
            </el-form-item>
            <el-form-item label="短信签名" prop="sign">
                <el-input  v-model="editForm.sign" placeholder="短信签名" :maxlength="64" @change="editSomeFields(editForm,'sign',$event)" :disabled="  disabledJudge('sign')"/>
            </el-form-item>
            <el-form-item label="用户回复的内容" prop="text">
                <el-input  v-model="editForm.text" placeholder="用户回复的内容" :maxlength="65535" @change="editSomeFields(editForm,'text',$event)" :disabled="  disabledJudge('text')"/>
            </el-form-item>
            <el-form-item label="创建时间" prop="createDate">
                <el-date-picker type="date" placeholder="选择日期"  v-model="editForm.createDate"  value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd" :disabled="  disabledJudge('createDate')"></el-date-picker>
            </el-form-item>
            <el-form-item label="回复短信处理状态0待处理1已处理成功2处理失败3延后处理" prop="status">
                <el-input  v-model="editForm.status" placeholder="回复短信处理状态0待处理1已处理成功2处理失败3延后处理" :maxlength="1" @change="editSomeFields(editForm,'status',$event)" :disabled="  disabledJudge('status')"/>
            </el-form-item>
            <el-form-item label="扩展字段" prop="extendNo">
                <el-input  v-model="editForm.extendNo" placeholder="扩展字段" :maxlength="64" @change="editSomeFields(editForm,'extendNo',$event)" :disabled="  disabledJudge('extendNo')"/>
            </el-form-item>
            <el-form-item label="关联的流水编号" prop="flowId">
                <el-input  v-model="editForm.flowId" placeholder="关联的流水编号" :maxlength="64" @change="editSomeFields(editForm,'flowId',$event)" :disabled="  disabledJudge('flowId')"/>
            </el-form-item>
        </el-form>
    </el-row>
    <slot name="footer" :page="this">
        <el-row v-if="showBtn!==false" style="float:right;" class="footer">
            <el-button @click.native="close">关闭</el-button>
            <el-button v-if="currOpType=='add'" v-loading="load.edit" type="primary" @click.native="saveSubmit" :disabled="disabledJudge('addBtn') || !checkBtnQx('addBtn',menuDefId) || load.edit">提交</el-button>
        </el-row>
    </slot>
</el-row>
</template>

<script>
import * as SmsReplyApi from '@/api/mdp/sms/smsReply';
import { mapGetters } from 'vuex'
import { MdpFormMixin } from '@/components/mdp-ui/mixin/MdpFormMixin.js';

export default {
    name:'smsReplyForm',
    mixins:[MdpFormMixin],
    components: {
    },
    computed: {
    },
    props:{
    },
    watch: {
    },
    data() {
        return {
            menuDefId:'',//menu_def.id 菜单表菜单编号，用于按钮权限判断
            pkNames:["id"],//表格主键的java属性名称，驼峰命名，默认为id,支持多主键
            currOpType:'add',//表单 add、edit，所有按钮可动、detail-只看不能操作
            editFormRules: {
                id:[
                //{ required: true, message: '此项必填', trigger: 'change' },
                //{ min: 1,max: 200, message: '长度在1到200之间', trigger: 'change'}
                ]
            },
            editForm: {
                id:'',extend:'',mobile:'',nationcode:'',sign:'',text:'',createDate:'',status:'',extendNo:'',flowId:''
            },
            //增删改查(含批量)接口
            apis:{
                queryById: SmsReplyApi.querySmsReplyById,
                add: SmsReplyApi.addSmsReply,
                edit: SmsReplyApi.editSmsReply,
                editSomeFields: SmsReplyApi.editSomeFieldsSmsReply
            },
            editable:true,//是否可编辑模式
        }
    },
    methods: {
         //由组件扩展添加其它的初始页面的逻辑(mounted+onOpen都会调用此函数，建议只添加公共逻辑)
         initCurrData(){

         },
        /**
         * 检查参数是否满足调用后台接口的条件
         * @returns true / false
         */
        preParamCheck(params){
            return true;
        },
        /**
         * 对修改的字段进行判断，返回false ,将取消更新数据库,由组件扩展
         * @param {*} row 当前选中的行
         * @param {*} fieldName 修改的字段名
         * @param {*} $event 修改后的值
         * @param {*} params 将要提交服务器的参数
         * @returns true/false 返回false ,将取消更新数据库
         */
        editSomeFieldsCheck(row,fieldName,$event,params){
            if(this.editable==false){
                return false;
            }
            params[fieldName]=$event
            return true;
        },
    },
    mounted() {

    }
}

</script>

<style scoped>

</style>